package com.kedi.productcenter.controller;

import com.kedi.productcenter.enums.ResultEnum;
import com.kedi.productcenter.exception.CommonException;
import com.kedi.productcenter.service.OpusCommentService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
import java.util.Map;

/**
* @Description:    查询所有评论
* @Author:         ytw
* @CreateDate:     2019/7/12 10:34
* @UpdateRemark:   修改内容
* @Version:        1.0
*/
@RestController
public class OpusCommentController {
    private static Logger logger = LoggerFactory.getLogger(BlsController.class);
    @Autowired
    private OpusCommentService service;

    /**
    * 方法实现说明  根据商品id 获取商品评论
    * @author      ytw
    *@param
    * @return
    * @exception   
    * @date        2019/7/22 14:34
    */
    @RequestMapping("/opus_appraise/list")
    public List<Map<String,Object>> findList(@RequestParam("opusid") Integer id){
        List<Map<String, Object>> list = service.findList(id);
        if(list.isEmpty()){
            logger.info("查找所有比南山作品列表为空");
            throw new CommonException(ResultEnum.LIST_NOT_EXISTED);
        }else{
            return list;
        }}
}
